#include <stdio.h>
#include <string.h>

int main() {
    int i = 0, j = 0, k = 0;
    char *p = NULL;

    /*
    char arr1[3] = {0};
    printf("一维arr1占用字节数: %d\n", sizeof(arr1));
    printf("一维数组arr1地址\n");
    for(i = 0; i < sizeof(arr1); i++){
        printf("%p ", arr1 + i);
    }
    printf("\n");
    memset(&arr1[0], 2, sizeof(arr1));
    printf("一维数组arr1内容\n");
    for(i = 0; i < sizeof(arr1); i++){
        printf("%d ", arr1[i]);
    }
    printf("\n");
     */

    /*
    char arr2[3][3];
    printf("二维数组rr2占用字节数: %d\n", sizeof(arr2));
    printf("二维数组arr2地址\n");
    p = &arr2[0][0];
    for(i = 0; i < sizeof(arr2); i++){
        if(i % 3 == 0){
            printf("\n");
        }
        printf("%p ", p + i);
    }
    printf("\n");
    memset(&arr2[0][0], 3, sizeof(arr2));
    p = &arr2[0][0];
    printf("二维数组arr2内容\n");
    for(i = 0; i < sizeof(arr2); i++){
        if(i % 3 == 0){
            printf("\n");
        }
        printf("%d ", *(p + i));
    }
    printf("\n");

    printf("按列输出二维数组arr2元素地址\n");
    for(i = 0; i < 3; i++){
        for(j = 0; j < 3; j++){
            printf("%p ", &arr2[i][j]);
        }
        printf("\n");
    }
    printf("\n");
     */

    char arr3[3][3][3];
    /*
    printf("三维数组arr3占用字节数: %d\n", sizeof(arr3));
    printf("三维数组arr3地址\n");
    p = &arr3[0][0][0];
    for(i = 0; i < sizeof(arr3); i++){
        if(i % 3 == 0){
            printf("\n");
        }
        printf("%p ", p + i);
    }
    printf("\n");
    printf("三维数组arr3内容\n");
    memset(&arr3[0][0][0], 4, sizeof(arr3));
    for(i = 0; i < sizeof(arr3); i++){
        if(i % 3 == 0){
            printf("\n");
        }
        printf("%d ", *(p + i));
    }
    printf("\n");
     */

    printf("三维数组arr3元素内存地址\n");
    for(i = 0; i < 3; i++){
        for(j = 0; j < 3; j++){
            for(k = 0; k < 3; k++){
                printf("%p ", &arr3[i][j][k]);
            }
            printf("\n");
        }
        printf("\n");
    }
    printf("\n");

    return 0;
}
